
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>

char* ToSameLetter(char *s)
{
    char *temp = s;
    while(*temp != '\0')
    {
        if(*temp <= 'Z' && *temp >= 'A')
        {
            *temp = *temp + 32;
        }
        temp++;
    }
    return s;
}

char *OnlyLetter(char *s)
{
    char *s1 = ToSameLetter(s);
    char *s2 = (char*)malloc(sizeof(char) * strlen(s));
    while(*s1 != '\0' && (*s1 <= 'z' && *s1 >= 'a'))
    {
        *s2 = *s1;
        s2++;
        s1++;
    }
    *s2 = '\0';
    return s2;
}

bool isPalindrome(char* s) 
{
    char *s1 = OnlyLetter(s);
    int left = 0;
    int right = strlen(s1) - 1;
    while(left < right)
    {
        while(left < right && s1[left] == s1[right])
        {
            left++;
            right--;
        }
        if(left < right)
            return false;
    }
    if(left == right)
        return true;
    return false;
}

int main()
{
    char s[100] = "A man, a plan, a canal: Panama";
    printf("%d\n",isPalindrome(s));
    return 0;
}